<template>
  <div id="app">
    <el-config-provider :locale="locale">
      <router-view />
    </el-config-provider>
  </div>
</template>

<script>
import { defineComponent, onMounted } from "vue";
import { ElConfigProvider } from "element-plus";
import zhCn from "element-plus/dist/locale/zh-cn.mjs";

export default defineComponent({
  components: {
    ElConfigProvider,
  },
  setup() {
    const debounce = (fn, delay) => {
      let timer = null;
      return function () {
        let context = this;
        let args = arguments;
        clearTimeout(timer);
        timer = setTimeout(function () {
          fn.apply(context, args);
        }, delay);
      };
    };
    onMounted(() => {
      const _ResizeObserver = window.ResizeObserver;
      window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
        constructor(callback) {
          callback = debounce(callback, 16);
          super(callback);
        }
      };
    });

    return {
      locale: zhCn,
    };
  },
  mounted() {
  },
});
</script>

<style></style>